package cn.tedu.recruitmentwebsite.jobSeeker.controller;

import cn.tedu.recruitmentwebsite.base.pojo.entity.Job;
import cn.tedu.recruitmentwebsite.base.pojo.vo.EducationVO;
import cn.tedu.recruitmentwebsite.base.pojo.vo.ExperienceVO;
import cn.tedu.recruitmentwebsite.base.pojo.vo.JobVO;
import cn.tedu.recruitmentwebsite.base.response.JsonResult;
import cn.tedu.recruitmentwebsite.jobSeeker.service.JobSeekerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("jobSeeker")
@Slf4j
public class JobSeekerController {
    @Autowired
    private JobSeekerService jobSeekerService;
    @GetMapping("/getAllJobs")
    public JsonResult getAllJobs() {
        List<JobVO> jobs = jobSeekerService.selectJobs();
        log.info("查询所有职位：{}",jobs);
        return JsonResult.ok(jobs);
    }
    @GetMapping("/getJobs")
    public JsonResult getJobs(@RequestParam(value = "KeyWord", required = false) String keyWord) {
        log.info("根据{}查询职位：",keyWord);
        List<JobVO> jobs = jobSeekerService.selectJobsByKeyWord(keyWord);

        return JsonResult.ok(jobs);
    }
    @GetMapping("/selectExperience")
    public JsonResult selectExperience(@RequestParam Integer id) {
        log.info("id为{}的工作经验",id);
       List<ExperienceVO> experiences =  jobSeekerService.selectExperience(id);
       log.info("查询到的工作经验：{}",experiences);
        return JsonResult.ok(experiences);
    }
    @GetMapping("/selectEducation")
    public JsonResult selectEducation(@RequestParam Integer id) {
        log.info("id为{}的教育经历",id);
        List<EducationVO> Education =  jobSeekerService.selectEducation(id);
        log.info("查询到的教育经历：{}",Education);
        return JsonResult.ok(Education);
    }

}
